from TurtleWorld import *
from math import *
 
world=TurtleWorld()
qqq=Turtle()
 
#----------------------------TRIANGLES----------------------------#

def equilateral_tri(t, size=100, rotate=0):
    print "Equilateral Triangle, with Size:", size, "and Rotation:", rotate
    t.rt(rotate)
    t.lt(60)
    for i in range (3):
        t.fd(size)
        t.rt(120)
    t.rt(60)
    
#--------------------------QUADRILATERALS-------------------------#

def para(t, width=100, height=100, angle=120, rotate=0):
    print "Parallelogram, with Width:", width, "Height:", height, "Angle:", angle, "and Rotation:", rotate
    for i in range (2):
        t.fd(width)
        t.lt(angle)
        t.fd(height)
        t.lt(angle/2)

def rhombus(t, size=100, angle=120, rotate=0):
    print "Rhombus, with Size:", size, "Angle:", angle, "and Rotation:", rotate
    t.lt(rotate)
    for i in range (2):
        t.fd(size)
        t.rt(angle)
        t.fd(size)
        t.rt(angle/2)

def rectangle(t, width=100, height=100, rotate=0):
    print "Rectangle, with Width:", width, "Height:", height, "and Rotation:", rotate
    t.lt(rotate)
    for i in range (2):
        t.fd(width)
        t.rt()
        t.fd(height)
        t.rt()

def square(t, size=100, rotate=0):
    print "Sqaure, with Size:", size, "and Rotation:", rotate
    t.lt(rotate)
    for i in range (4):
        t.fd(size)
        t.rt()
#------------------------------MOVEMENT---------------------------#
def line(t, x=100, y=100):
    print "Line to a point X:", x, "over and Y:", y, "up"
    length=sqrt(z**2+y**2)
    t.lt(degrees(atan=(x/y)))
    t.fd(sqrt(length))
    t.rt(degrees(atan(x/y)))
def move(t, x, y):
    print "Move without marking to a point X:", x, "over and Y:", y, "up"
    t.pu()
    t.fd(x)
    t.lt()
    t.fd(y)
    t.rt()
    t.pd()
    
#------------------------------OTHER SHAPES------------------------#
def davidstar(t):
    equilateral_tri(t)
    t.lt()
    t.pu()
    t.fd(55)
    t.rt()
    t.fd(100)
    t.pd()
    equilateral_tri(t, 100, 180)
    t.lt(180)
    
"""
Build any other shape functions you want.
Some Ideas:
    Right Triangles (sss, sas, etc)
    Arbitrary Triangles
    Circle
    Arcs
    Go Wild!
    
Bonus for working or challenging functions...no penalty for trying something
"""

#------------------------------TEST-------------------------------#
equilateral_tri(qqq)
para(qqq)
rhombus(qqq)
rectangle(qqq)
square(qqq)
line(qqq)
move(qqq, 100, 100)
davidstar(qqq)

wait_for_user()